<?php
/**
 * Created by PhpStorm.
 * User: lullabies
 * Date: 2019/5/22
 * Time: 18:11
 */

namespace app\api\model;


use think\Model;

class Subjects extends Model
{
    /**
     * 与分数表形成一对多关联
     */
    public function grade(){
        return $this->belongsTo('grade','subjects_id','id');
    }
    /**
     * 根据科目id获取相关内容
     */
    public static function getInfoById($id){
        $result = self::where('status',1)->hidden(['status'])->find($id);
        return $result;
    }
}